https://leetcode.cn/problems/validate-binary-search-tree/
class Solution {
public:
    long preval=LONG_MIN;;
    bool isValidBST(TreeNode* root) {
        if(root==nullptr)
            return true;
            
        bool left=isValidBST(root->left);
        if(left==false) return false;
        
        bool cur=false;
        if(root->val > preval)
            cur=true;
        preval=root->val;

        bool right=isValidBST(root->right);
        
        return left&&right&&cur;
    }

};